#pragma once
#include "Header.h"
#include "ntstruct.h"

typedef BOOLEAN(NTAPI* EX_ENUMERATE_HANDLE_ROUTINE)(
    IN PHANDLE_TABLE_ENTRY HandleTableEntry,
    IN HANDLE Handle,
    IN PVOID EnumParameter
    );

BOOLEAN ExEnumHandleTable(
    IN PVOID HandleTable,
    IN EX_ENUMERATE_HANDLE_ROUTINE EnumHandleProcedure,
    IN PVOID EnumParameter,
    OUT PHANDLE Handle OPTIONAL
);

POBJECT_TYPE NTAPI ObGetObjectType(PVOID lpObject);

NTSTATUS Ps2GetProcessFullDosName(IN PEPROCESS lpEprocess, IN PUNICODE_STRING lpDosFullName);

NTSTATUS Ps2GetProcessFullDosNameByPid(IN HANDLE Pid, IN PUNICODE_STRING lpDosFullName);

BOOLEAN Ps2DecreaseProcessHandlePrivilege(IN ULONG dwProcessId, IN PCWCH lpProtectName);

HANDLE Ob2RegisterCallbacks(
    IN PCWCH lpAltitude,
    IN POBJECT_TYPE* ppObjectType,
    IN POB_PRE_OPERATION_CALLBACK lpPreOperation,
    IN POB_POST_OPERATION_CALLBACK lpPostOperation,
    IN PVOID lpRegistrationContext
);

HANDLE Ob2RegisterCallbacks2(
    IN PCWCH lpAltitude,
    IN PVOID lpRegistrationContext,
    IN POB_OPERATION_REGISTRATION lpObOperationRegistration,
    IN USHORT OperationRegistrationCount
);

void Ob2UnRegisterCallbacks(IN HANDLE hRegister);

OB_PREOP_CALLBACK_STATUS ObPreOperationProcessCallback(
    IN PVOID lpRegistrationContext,
    IN POB_PRE_OPERATION_INFORMATION lpObOperationInformation
);

OB_PREOP_CALLBACK_STATUS ObPreOperationThreadCallback(
    IN PVOID lpRegistrationContext,
    IN POB_PRE_OPERATION_INFORMATION lpObOperationInformation
);
